package com.chen.service.court;

import com.chen.dao.CourtMapper;
import com.chen.pojo.Court;
import com.chen.pojo.Type;
import com.chen.vo.CourtVo;

import java.util.List;

public class CourtServiceImpl implements CourtService {
    //service层 调用 dao层，整合dao层进来
    private CourtMapper courtMapper;
    //set方法，spring就能注入进来
    public void setCourtMapper(CourtMapper courtMapper) {
        this.courtMapper = courtMapper;
    }

    public int addCourt1(Court court) {
        return courtMapper.addCourt1(court);
    }
    public int deleteCourtById(int courtId) {
        return courtMapper.deleteCourtById(courtId);
    }

    public int updateCourt1(Court court) {
        return courtMapper.updateCourt1(court);
    }

    public Court queryCourtById(int courtId) {
        return courtMapper.queryCourtById(courtId);
    }

    public List<Court> queryCourtByType(int courtType) {
        return courtMapper.queryCourtByType(courtType);
    }

    public List<Court> queryCourtLike(String value) {
        return courtMapper.queryCourtLike(value);
    }

    public List<Court> queryAllCourt() {
        return courtMapper.queryAllCourt();
    }

    public List<Court> list(CourtVo courtVo) {

        return courtMapper.list(courtVo);
    }

    public int addCourt(Court court) {
        return courtMapper.addCourt(court);
    }

    public int updateCourt(Court court) {
        return courtMapper.updateCourt(court);
    }

    public int deleteById(Integer courtId) {
        return courtMapper.deleteById(courtId);
    }

    public List<Court> findCourtByAddress(String courtAddress,Integer size) {
        return courtMapper.findCourtByAddress( courtAddress,size);
    }

    public Court findById(Integer courtID) {
         Court court = courtMapper.findById(courtID);
         if (court.getCourtStatus() == 0){
             court.setCourtStatusStr("可预约");
         }else{
             court.setCourtStatusStr("已预约");
         }
        return court;
    }

    public List<Court> listTime(CourtVo courtVo) {
        return courtMapper.listTime(courtVo);
    }

    public List<Court> addressList1(CourtVo courtVo) {
        return courtMapper.addressList1(courtVo);
    }

    public List<Court> addressList2(CourtVo courtVo) {
        return courtMapper.addressList2(courtVo);
    }

    public List<Court> addressList3(CourtVo courtVo) {
        return courtMapper.addressList3(courtVo);
    }
}
